﻿using System;
using Sirenix.OdinInspector;

namespace Gp.Scripts.Core {
    public enum WeaponTypeCode {
        [LabelText("无")]
        None = 0,
        
        [LabelText("双手剑")]
        GreatSword = 1,
        
        [LabelText("匕首")]
        Dagger = 2,
        
        [LabelText("杖")]
        Stick = 3,
        
        
        [LabelText("单手剑")]
        LightSword = 4,
        
        
        [LabelText("剑盾")]
        Shield = 5,
        
        
        // [LabelText("单手剑")]
        // LightSword = 6,
        
        
        
        [LabelText("手枪")]
        Pistol = 10,   
        
        [LabelText("步枪")]
        Rife = 11,
        [LabelText("喷射器")]
        FireSpit = 12,
        
        
    }
    
    
    
    
    
    public static class WeaponModelCodeExtend{

        public static string LabelName(this WeaponTypeCode code) {
            return code switch {
                WeaponTypeCode.None => "未知",
                WeaponTypeCode.GreatSword => "双手剑",
                WeaponTypeCode.Dagger => "匕首",
                WeaponTypeCode.Stick => "法杖",
                WeaponTypeCode.LightSword => "长剑",
                WeaponTypeCode.Shield => "剑盾",
                WeaponTypeCode.Pistol => "重型手枪",
                WeaponTypeCode.Rife => "自动步枪",
                WeaponTypeCode.FireSpit => "喷射器",
                _ => "未知"
            };
        }
        
        
        
        public static int CodeNumber(this WeaponTypeCode code) {
            return (int) code;
        }

        public static bool IsMeleeWeapon(this WeaponTypeCode code) {
            return code.CodeNumber() < 10;
        }


        public static bool IsShield(this WeaponTypeCode code) {
            return code.CodeNumber() == (int)WeaponTypeCode.Shield;
        }

        public static bool IsRanged(this WeaponTypeCode code) {
            return code.CodeNumber() >= 10;
        }
    }
}